<#include "../public/header.html">
    <script type="text/javascript" src="public/js/datagrid-detailview.js"></script>
    <div id="editdlg">
    </div>
    <div class="easyui-layout" style="width:100%;height:100%;">
        <div id="p" data-options="region:'west'" title="校区" style="width:20%;padding:10px">
            <ul id="tt" class="easyui-tree" data-options="url:'admin/department/combotree',method:'get',animate:true,onClick:tree_select,lines:true"></ul>
        </div>
        <div data-options="region:'center'" title="项目信息">
            <div id="seach_view">
                <div  style="padding:5px 5px; border-bottom: dashed #d2d2d2 1px">
                    项目编号: <input class="easyui-textbox" style="width:110px" id="project_code">
                    项目名称: <input class="easyui-textbox" style="width:110px" id="project_name">
                    <a href="javascript://" class="easyui-linkbutton" iconCls="icon-search" onclick="search_but()">搜索</a>
                </div>

            </div>
            <table id="list" class="easyui-datagrid" style="width:100%;height:100%"
                   sortName="id"
                   sortOrder="asc"
                   pagination="true"
                   pagesize="50"
                   singleSelect="true"
                   data-options="url:'admin/project/listJson',toolbar:'#seach_view'">
                <thead>
                <tr>
                    <th width="100" field="status_name"  align="center" sortable="true" data-options="formatter:for_status">当前环节</th>
                    <th width="100" field="dep_name"  align="center" sortable="true">单位名称</th>
                    <th width="100" field="project_code"  align="center" sortable="true">项目编号</th>
                    <th width="100" field="project_name"  align="center" sortable="true">项目名称</th>
                    <th width="100" field="project_rank_name"  align="center" sortable="true">项目级别</th>
                    <th width="140" field="project_type_name"  align="center" sortable="true">项目类别</th>
                    <th width="100" field="project_plan_begin_time"  align="center" sortable="true">计划开始时间</th>
                    <th width="100" field="project_plan_end_time" align="center" sortable="true">计划结束时间</th>
                    <th width="100" field="project_plan_user_num"  align="center" sortable="true">计划考试人数</th>
                    <th width="120" field="project_is_training_name"  align="center" sortable="true">考前培训</th>
                    <th width="100" field="project_is_temporary_place_name"  align="center" sortable="true">是否需要临时考场</th>
                    <th width="100" field="project_theory_time"  align="center" sortable="true">理论考试时间</th>
                    <th width="120" field="project_theory_place"  align="center" sortable="true">理论考试地点</th>
                    <th width="120" field="project_reality_time"  align="center" sortable="true">实操考试时间</th>
                    <th width="120" field="project_reality_place"  align="center" sortable="true">实操考试地址</th>
                    <th width="120" field="project_testing_money"  align="center" sortable="true">正考费用</th>
                    <th width="120" field="project_theory_money"  align="center" sortable="true">单理论</th>
                    <th width="120" field="project_reality_money"  align="center" sortable="true">单实操</th>
                    <th width="120" field="project_register_num"  align="center" sortable="true">报考人数</th>
                    <th width="120" field="project_testing_num"  align="center" sortable="true">正考人数</th>
                    <th width="120" field="project_bk_theory_num"  align="center" sortable="true">补考理论人数</th>
                    <th width="120" field="project_bk_reality_num"  align="center" sortable="true">补考实操人数</th>
                    <th width="120" field="project_payment_num"  align="center" sortable="true">缴费人数</th>
                    <th width="120" field="project_payment_money"  align="center" sortable="true">缴费总数</th>
                    <th width="120" field="project_is_upload_info_name"  align="center" sortable="true">报考资料</th>
                    <th width="120" field="project_payment_status_name"  align="center" sortable="true">缴费状态</th>
                    <th width="120" field="project_card_status"  align="center" sortable="true">发证状态</th>
                    <th width="120" field="create_user_name"  align="center" sortable="true">创建人</th>
                    <th width="140" field="create_time" align="center" sortable="true" data-options="formatter:function(value,row,index){
                         return formatDate(value);
                         } ">创建时间</th>
                </tr>
                </thead>
            </table>


        </div>
    </div>


    <script type="text/javascript">


        var content;
        var id ;
        var dep_id;
        $(function(){
            $("#seach_view").prependTo(".datagrid-toolbar");

            $('#list').datagrid({
                view: detailview,
                detailFormatter:function(index,row){
                    return '<div style="padding:2px;"><table class="ddv"></table></div>';
                },
                onExpandRow: function(index,row){
                    var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
                    ddv.datagrid({
                        url:'admin/project_class/listJson?project_id='+row.id,
                        fitColumns:true,
                        rownumbers:true,
                        pagination:true,
                        singleSelect:true,
                        loadMsg:'',
                        columns:[[
                            {field:'id',title:'操作',width:50,align:'center',formatter:for_view},
                            {field:'class_name',title:'报考班级',width:100,align:'center'},
                            {field:'project_name',title:'项目名称',width:100,align:'center'},
                            {field:'project_rank_name',title:'项目级别',width:100,align:'center'},
                            {field:'project_testing_money',title:'正考费用',width:100,align:'center'},
                            {field:'project_theory_money',title:'单理论',width:100,align:'center'},
                            {field:'project_reality_money',title:'单实操',width:100,align:'center'},
                            {field:'project_register_num',title:'报考人数',width:100,align:'center'},
                            {field:'project_testing_num',title:'正考人数',width:100,align:'center'},
                            {field:'project_bk_theory_num',title:'补考理论人数',width:100,align:'center'},
                            {field:'project_bk_reality_num',title:'补考实操人数',width:100,align:'center'},
                            {field:'project_payment_num',title:'缴费人数',width:100,align:'center'},
                            {field:'project_payment_money',title:'缴费总数',width:100,align:'center'},
                            {field:'project_is_upload_info_name',title:'报考资料',width:100,align:'center'},
                            {field:'project_payment_status_name',title:'缴费状态',width:100,align:'center'},
                            {field:'project_card_status_name',title:'发证状态',width:100,align:'center'},
                            {field:'status_name',title:'当前状态',width:100,align:'center'},
                            {field:'user_name',title:'创建用户',width:100,align:'center'},
                            {field:'create_time',title:'创建时间',width:100,align:'center',formatter:function(value,row,index){
                                return formatDate(value);
                            }}
                        ]],
                        onResize:function(){
                            $('#list').datagrid('fixDetailRowHeight',index);
                        },
                        onLoadSuccess:function(){
                            setTimeout(function(){
                                $('#list').datagrid('fixDetailRowHeight',index);
                            },0);
                        }
                    });
                    $('#dg').datagrid('fixDetailRowHeight',index);
                }
            });
        });

        function search_but(){
            $("#list").datagrid("reload",{project_name:$("#project_name").val(),project_code:$("#project_code").val()});
        }

        function tree_select(note){
            dep_id = note.id;
            $("#list").datagrid("reload",{student_name:$("#student_name").val(),student_id_cart:$("#student_id_cart").val(),dep_id:id,type:note.type});
        }

        function for_view(val,row){
            return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="view_class_detail('+row.id+')" data-options="iconCls:\'icon-view\',plain:\'true\'" >查看</a>';
        }

        function for_status(val,row){
            return "<a onclick='status_onclick("+row.id+",290)'>"+val+"</a>";
        }

        function status_onclick(project_id,type){
            $.messager.progress({
                text:'数据加载中....',
                interval:100
            });

            $("#editdlg").dialog({
                title:"查询状态记录",
                iconCls: 'icon-edit',
                width: 700,
                height: 400,
                closed: false,
                cache: false,
                modal: true,
                href:"admin/project_examination/project_record?project_id="+project_id+"&exa_type="+type,
                onLoad:function() {
                    $.messager.progress('close');
                },
                buttons:[]
            });
        }

        var view_class_detail = function (id) {

            $("#editdlg").window({
                title: "班级收费确认",
                iconCls: 'icon-edit',
                width: '100%',
                height: '100%',
                closed: false,
                cache: false,
                modal: true,
                href: "admin/project_class/class_detail_student?project_class_id="+id,
                onLoad: function () {
                    $.messager.progress('close');
                }
            });
        }


    </script>
<#include "../public/footer.html">